[FORMAT "WCOFF"]
[INSTRSET "i486p"]
[OPTIMIZE 1]
[OPTION 1]
[BITS 32]
[FILE "fifo.c"]
[SECTION .text]
	ALIGN	2
	GLOBAL	_fifo8_init
_fifo8_init:
	PUSH	EBP
	MOV	EBP,ESP
	MOV	EAX,DWORD [8+EBP]
	MOV	ECX,DWORD [12+EBP]
	MOV	EDX,DWORD [16+EBP]
	MOV	DWORD [12+EAX],ECX
	MOV	DWORD [EAX],EDX
	MOV	DWORD [16+EAX],ECX
	MOV	DWORD [20+EAX],0
	MOV	DWORD [4+EAX],0
	MOV	DWORD [8+EAX],0
	POP	EBP
	RET
	ALIGN	2
	GLOBAL	_fifo8_put
_fifo8_put:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	MOV	ECX,DWORD [8+EBP]
	MOV	EBX,DWORD [12+EBP]
	CMP	DWORD [16+ECX],0
	JNE	L3
	OR	DWORD [20+ECX],1
	OR	EAX,-1
L2:
	POP	EBX
	POP	EBP
	RET
L3:
	MOV	EAX,DWORD [ECX]
	MOV	EDX,DWORD [4+ECX]
	MOV	BYTE [EDX+EAX*1],BL
	MOV	EAX,DWORD [4+ECX]
	INC	EAX
	MOV	DWORD [4+ECX],EAX
	CMP	EAX,DWORD [12+ECX]
	JE	L5
L4:
	DEC	DWORD [16+ECX]
	XOR	EAX,EAX
	JMP	L2
L5:
	MOV	DWORD [4+ECX],0
	JMP	L4
	ALIGN	2
	GLOBAL	_fifo8_get
_fifo8_get:
	PUSH	EBP
	OR	EAX,-1
	MOV	EBP,ESP
	PUSH	ESI
	PUSH	EBX
	MOV	ECX,DWORD [8+EBP]
	MOV	ESI,DWORD [16+ECX]
	MOV	EBX,DWORD [12+ECX]
	CMP	ESI,EBX
	JE	L6
	MOV	EAX,DWORD [8+ECX]
	MOV	EDX,DWORD [ECX]
	MOVZX	EDX,BYTE [EAX+EDX*1]
	INC	EAX
	MOV	DWORD [8+ECX],EAX
	CMP	EAX,EBX
	JE	L9
L8:
	LEA	EAX,DWORD [1+ESI]
	MOV	DWORD [16+ECX],EAX
	MOV	EAX,EDX
L6:
	POP	EBX
	POP	ESI
	POP	EBP
	RET
L9:
	MOV	DWORD [8+ECX],0
	JMP	L8
	ALIGN	2
	GLOBAL	_fifo8_status
_fifo8_status:
	PUSH	EBP
	MOV	EBP,ESP
	MOV	EDX,DWORD [8+EBP]
	POP	EBP
	MOV	EAX,DWORD [12+EDX]
	SUB	EAX,DWORD [16+EDX]
	RET
